﻿using NUnit.Framework;
using StructureMap;
using SvnDeploy.Service.Cfg;

namespace SvnDeploy.Service
{
    [TestFixture]
    public class SvnDeploymentRegistryTests
    {
        [TestFixtureSetUp]
        public void BeforeAllTests()
        {
            ObjectFactory.Configure(cfg => cfg.AddRegistry(new SvnDeploymentRegistry()));
        }

        [Test]
        public void RegistryIsValid()
        {
            ObjectFactory.AssertConfigurationIsValid();
        }

        [Test]
        public void GetInstance_IDeploymentWorker_ReturnsInstance()
        {
            var deploymentWorker = ObjectFactory.GetInstance<IDeploymentWorker>();
            Assert.IsNotNull(deploymentWorker);
        }

        [Test]
        public void GetInstance_ISvnAdapter_ReturnsInstance()
        {
            var svnAdapter = ObjectFactory.GetInstance<ISvnAdapter>();
            Assert.IsNotNull(svnAdapter);
        }

        [Test]
        public void GetInstance_IVirtualDirectoryUpdater_ReturnsInstance()
        {
            var virtualDirectoryUpdater = ObjectFactory.GetInstance<IVirtualDirectoryUpdater>();
            Assert.IsNotNull(virtualDirectoryUpdater);
        }

        [Test]
        public void GetInstance_SvnDeployConfiguration_ReturnsInstance()
        {
            var config = ObjectFactory.GetInstance<SvnDeployConfigurationSection>();
            Assert.IsNotNull(config);
        }
    }
}
